import IsRead from '@/components/others/isRead'
import {View} from '@tarojs/components'

const AbnormalMsgRaw: React.FC<{
  abnormal: Device.AbnormalLog
}> = ({abnormal}): JSX.Element => {
  return (
    <View
      className={`px-16 relative ${abnormal.isRead === 1 ? 'opacity-90' : ''}`}
    >
      <View className="absolute top-6 right-22">
        <IsRead isRead={abnormal.isRead}></IsRead>
      </View>

      <View
        className="w-full  mb-10 bg-white rounded-card overflow-hidden px-12"
        onClick={() => {
          // if (['error', 'offLine'].includes(type)) {
          //   toHomeabnormalInfo(devId)
          // } else {
          //   toHomeSingleDevParams(devId)
          // }
        }}
      >
        {/* 消息头部 */}
        <View className="w-full h-20 my-12 flex justify-between">
          <View className="hanzi flex-1 h-full text-14 font-medium truncate">
            {abnormal.devName}
          </View>
          <View className="hanzi w-116 h-13 text-11 text-xxx_text mt-4 truncate">
            {abnormal.createTime}
          </View>
        </View>
        {/* 消息内容，超长可换行 */}
        <View className="hanzi w-full min-h-18 break-words pb-12 text-13 leading-20">
          {/* 
              {type === 'error' ? <TroubleItem></TroubleItem> : null}
              {type === 'offLine' ? <OffLineItem></OffLineItem> : null}
              {type === 'params' ? <ParamsItem list={list || []}></ParamsItem> : null} 
          */}
          {abnormal.devLogContent}
        </View>
      </View>
    </View>
  )
}
export default AbnormalMsgRaw
